<?php
/**
 * @package WordPress
 * @subpackage Freshine
 * @since Freshine 1.1.0
 */
?>

<div id="f9-comments">

<?php if ( post_password_required() ) : ?>
	<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'f9vn' ); ?></p>
</div><!-- #comments -->
<?php
		/* Stop the rest of comments.php from being processed,
		 * but don't kill the script entirely -- we still have
		 * to fully load the template.
		 */
		return;
	endif;
?>

<?php if (pings_open()) : ?>
    <p id="respond"><span id="trackback-link">
        <a href="<?php trackback_url() ?>" rel="trackback">Get a Trackback link</a>
    </span></p>
<?php endif; ?>

<?php if ( have_comments() ) : ?>

    <h2 id="comments-title">
		<?php
			printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'f9vn' ),
				number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
		?>
	</h2>

	<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
	<div id="comment-nav-above">
		<h1 class="assistive-text"><?php _e( 'Comment navigation', 'f9vn' ); ?></h1>
		<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'f9vn' ) ); ?></div>
		<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'f9vn' ) ); ?></div>
	</div>
	<?php endif; // check for comment navigation ?>
		
    <ol id="comments">
		<?php wp_list_comments( array( 'callback' => 'f9_comment' ) ); ?>
    </ol>
	
	<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
	<div id="comment-nav-below">
		<h1 class="assistive-text"><?php _e( 'Comment navigation', 'f9vn' ); ?></h1>
		<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'f9vn' ) ); ?></div>
		<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'f9vn' ) ); ?></div>
	</div>
	<?php endif; // check for comment navigation ?>

<?php elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
	
	<p class="nocomments"><?php _e( 'Comments are closed.', 'twentyeleven' ); ?></p>

<?php endif; ?>

<?php if (comments_open()) : ?>

    <div id="comments-form">
    
    <h2 id="comments-header">Leave a comment</h2>
    
    <?php if (get_option('comment_registration') && !$user_ID ) : ?>
        <p id="comments-blocked">You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=
        <?php the_permalink(); ?>">logged in</a> to post a comment.</p>
    <?php else : ?>

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

    <?php if ($user_ID) : ?>
    
    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php">
        <?php echo $user_identity; ?></a>. 
        <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" 
        title="Log out of this account">Logout</a>
    </p>
    
    <?php else : ?>
    	
        <span class="input-comment">
		<label for="author">Name<?php if ($req) _e(' (required)'); ?></label>
		<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="25" />
        </span>
        
        <span class="input-comment">
		<label for="email">E-mail<?php if ($req) _e(' (required)'); ?></label>
		<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="25" />
        </span>
        
        <span class="input-comment">
		<label for="url">Website</label>
		<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="25" />
        </span>
    <br class="clear" />
    <?php endif; ?>
	
    <?php /* You might want to display this: 
        <p>XHTML: You can use these tags: <?php echo allowed_tags(); ?></p> */ ?>

        <p><textarea name="comment" id="comment" rows="5" cols="104"></textarea></p>
        
        <?php /* Buttons are easier to style than input[type=submit], 
                but you can replace: 
                <button type="submit" name="submit" id="sub">Submit</button>
                with: 
                <input type="submit" name="submit" id="sub" value="Submit" />
                if you like */ 
        ?>
        <p><button type="submit" name="submit" id="sub">Submit</button>
        <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>"></p>
    
    <?php do_action('comment_form', $post->ID); ?>

    </form>
    </div>

<?php endif; // If registration required and not logged in ?>

<?php else : // Comments are closed ?>
    <p id="comments-closed">Sorry, comments for this entry are closed at this time.</p>
<?php endif; ?> 
</div>